package com.misic.wed;

import com.misic.pojo.SongList;
import com.misic.service.SongListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/songList")
public class SongListController {
    @Autowired
    private SongListService songListService;
    /**
     * 查询所有歌单
     */
    @GetMapping(value = "/allSongList")
    public List<SongList>  allSongList(){
        return songListService.allSongList();
    }
    /**
     * 根据标题模糊查询歌单列表
     */
    @GetMapping(value = "/likeTitle")
    public Object likeTitle(@RequestParam("title")String title){
//        String title = request.getParameter("title").trim();          //歌单标题
        return songListService.likeTitle("%"+title+"%");
    }
    /**
     * 根据风格模糊查询歌单列表
     */
    @GetMapping(value = "/likeStyle")
    public Object likeStyle(@RequestParam("style")String style){
//        String style = request.getParameter("style").trim();          //歌单风格
        return songListService.likeStyle("%"+style+"%");
    }
}
